<template>
    <Modal :mask-closable="false"
        v-model="opened"
        class="modal-title-layout"
        :title="title">

<!--            您确定要删除{{// this.currentNode.roleName}} ?-->
      <div class="icon red">
        <i class="iconfont zy-common-shanchu"></i>
      </div>
      <p class="title">
        <span>您确定要删除{{this.currentNode.roleName}} ?</span>
      </p>
        <div slot="footer">
            <Button type="default" @click="close">{{$t('common.Cancle')}}</Button>
            <Button type="primary" :loading="submitLoading" @click="submit">{{$t('maintenance.Confirmed')}}</Button>
        </div>
    </Modal>
</template>

<script>
import { deleteRoleSuper } from "@/api/system/organization";

export default {
    name: '',
    data() {
        return {
            opened: false,
            title: '删除角色',
            currentNode: {},
            submitLoading: false
        }
    },
    methods: {
        open( currentNode ) {
            this.currentNode = currentNode;

            this.opened = true;
        },
        close() {
            this.opened = false;
        },
        submit() {
            this.submitLoading = true;
            let params = {
                id: this.currentNode.id
            }
            deleteRoleSuper(params).then(res =>{
                if(res.code === 200){
                    this.close();
                    this.$Message.success(res.msg);
                    this.$emit('save');
                }else{
                    this.$Message.warning(({content:res.msg,duration:6,closable:true}));
                }
            }).finally(() =>{
                this.submitLoading = false;
            })
        }
    }
}
</script>
